package j04arraylist;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class J2 {
    public static void main(String[] args) {
        ArrayList<String> arr1 = new ArrayList<>();
        arr1.add("aa");
        arr1.add("bb");
        arr1.add("cc");
        arr1.add("dd");
        arr1.add("dd");
//        System.out.println("arr1.remove(\"cc\") = " + arr1.remove("cc"));
//        System.out.println("arr1.remove(\"cc\") = " + arr1.remove("cc"));
//        arr1.remove(0);

        List<String> l1 = new ArrayList<String>();
        l1.add("bb");
        l1.add("cc");

//        arr1.removeAll(l1);
//        arr1.clear();
//        arr1.set(1,"xxxx");
        System.out.println(arr1.contains("aa"));//true
        System.out.println(arr1.contains("a"));//false

        System.out.println(arr1.indexOf("aa"));//0

//        System.out.println("arr1 = " + arr1);
        for (int i = 0; i < arr1.size(); i++) {
            System.out.println(arr1.get(i));
        }
        System.out.println("====");
        Object[] objArr = arr1.toArray();
        System.out.println("objArr = " + objArr);//@
        System.out.println(Arrays.toString(objArr));
        System.out.println("<<<<<<<<<<<");
        //temp
        for (String s : arr1) {
            System.out.println("s = " + s);
        }
    }
}
